package com.sskj.trafficcontrol.consts;

import java.io.Serializable;

/**
 * Created by acmen on 15-8-6.
 * <p/>
 * JSON响应对象，均由此类封装
 *
 * @author acmen
 */
public class AppJsonInfo implements Serializable {

    // 成功为true 失败 为false
    private String success;
    // errCode=200：表示请求成功；其他值为失败
    private String errCode;
    // 失败或成功消息
    private String errMsg;
    // 返回的数据
    private Object body;

    private AppJsonInfo() {
    }

    public static AppJsonInfo build(String success,String errCode, Object body, String errMsg) {
        AppJsonInfo json = new AppJsonInfo();
        json.success = success;
        json.errCode = errCode;
        json.body = body == null ? new Object() : body;
        json.errMsg = errMsg == null ? "" : errMsg;
        return json;
    }


    public String getSuccess() {
        return success;
    }

    public void setSuccess(String success) {
        this.success = success;
    }

    /**
     * errCode=200：表示请求成功；其他值为失败
     *
     * @return
     */
    public String getErrCode() {
        return errCode;
    }

    public String getErrMsg() {
        return errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }

    public Object getBody() {
        return body;
    }

    public void setBody(Object body) {
        this.body = body;
    }
}
